package com.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.CarDao;
import com.entity.Car;
import com.entity.view.CarView;
import com.entity.vo.CarVO;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.stereotype.Service;
import com.service.CarService;

import java.util.Collections;
import java.util.List;
import java.util.Map;


@Service("carService")

public class CarServiceImpl extends ServiceImpl<CarDao, Car> implements CarService {



    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<Car> page = this.selectPage(
                new Query<Car>(params).getPage(),
                new EntityWrapper<Car>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<Car> wrapper) {
        Page<CarView> page =new Query<CarView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<CarVO> selectListVO(Wrapper<Car> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public CarVO selectVO(Wrapper<Car> wrapper) {
        return baseMapper.selectVO(wrapper);
    }

    @Override
    public List<CarView> selectListView(Wrapper<Car> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public CarView selectView(Wrapper<Car> wrapper) {
        return baseMapper.selectView(wrapper);
    }

    @Override
    public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<Car> wrapper) {
        return baseMapper.selectValue(params, wrapper);
    }

    @Override
    public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<Car> wrapper) {
        return baseMapper.selectTimeStatValue(params, wrapper);
    }

    @Override
    public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<Car> wrapper) {
        return baseMapper.selectGroup(params, wrapper);
    }



}
